# Maintainer: atom2013 <atom.long@hotmail.com>

_realname=packaging
pkgbase="python-${_realname}"
pkgname=("python3-${_realname}" "python2-${_realname}")
pkgver=16.8
pkgrel=4
pkgdesc="Core utilities for Python packages"
arch=('any')
url="https://github.com/pypa/packaging"
license=('Apache')
makedepends=('python3-setuptools' 'python2-setuptools' 'python3-pyparsing' 'python2-pyparsing' 'python2-six' 'python3-six' 'git')
checkdepends=('python-pytest-runner' 'python2-pytest-runner' 'python-pretend' 'python2-pretend' 'python-coverage' 'python2-coverage')
source=("git+https://github.com/pypa/packaging.git#tag=$pkgver")
sha256sums=('SKIP')

prepare() {
  cp -a packaging{,-py2}
}

build() {
  # Build python 3 module
  cd "${srcdir}"/packaging
  python3 setup.py build

  # Build python 2 module
  cd "${srcdir}"/packaging-py2
  python2 setup.py build
}

check() {
  # Check python3 module
  cd "${srcdir}"/packaging
  python3 setup.py ptr

  # Check python2 module
  cd "${srcdir}"/packaging-py2
  python2 setup.py ptr
}

package_python3-packaging() {
  depends=('python3-pyparsing' 'python3-six')

  cd "${srcdir}"/packaging
  python3 setup.py install --root "${pkgdir}"
}

package_python2-packaging() {
  depends=('python2-pyparsing' 'python2-six')

  cd "${srcdir}"/packaging-py2
  python2 setup.py install --root "${pkgdir}"
}
